package com.company.model.result;

import java.io.Serializable;

/**
 * Created by tu on 2017/1/1.
 */
public class BaseResult<T> implements Serializable {

  private static final long serialVersionUID = -7586516084128600569L;
  /**
   * {@link org.springframework.http.HttpStatus}
   *
   * @since 2.1.0
   */
  private int code = 200;

  private boolean success = true;

  private String msg;

  private T data;

  private String url;

  public BaseResult() {
  }

  public BaseResult(String msg) {
    this.msg = msg;
    this.success = false;
  }

  public BaseResult(String msg, String url) {
    this.msg = msg;
    this.url = url;
    this.success = false;
  }

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public T getData() {
    return data;
  }

  public void setData(T data) {
    this.data = data;
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  @Override
  public String toString() {
    return "BaseResult{" +
        "success=" + success +
        ", msg='" + msg + '\'' +
        ", data=" + data +
        ", url='" + url + '\'' +
        '}';
  }
}
